/*
* Copyright (C) Microsoft. All rights reserved.  
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not 
* use this file except in compliance with the License.  You may obtain a copy 
* of the License at http://www.apache.org/licenses/LICENSE-2.0  
* 
* THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 
* WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 
* MERCHANTABLITY OR NON-INFRINGEMENT. 
*
* See the Apache License, Version 2.0 for specific language governing 
* permissions and limitations under the License.
*
*/
#pragma once

#include <memory>
#include <baja/db/db_interfaces.h>

namespace baja { namespace storage {

class result_row : public iresult_row
{
public:
    result_row();
    static std::shared_ptr<result_row> create();

    // irow
    virtual void addCell(std::shared_ptr<icell> cell);
    virtual std::shared_ptr<std::vector<std::shared_ptr<icell>>> getCells();
private:
    std::shared_ptr<std::vector<std::shared_ptr<icell>>> _cells;
};

std::shared_ptr<iresult_row> createRow();

class result : public iresult
{
public:
    result();
    static std::shared_ptr<result> create();

    // iresult
    void addColumn(std::shared_ptr<icolumn> column);
    std::shared_ptr<std::vector<std::shared_ptr<icolumn>>> getColumns();

    void addRow(std::shared_ptr<iresult_row> row);
    std::shared_ptr<std::vector<std::shared_ptr<iresult_row>>> getRows();

    void dump();
private:
    std::shared_ptr<std::vector<std::shared_ptr<icolumn>>> _columns;
    std::shared_ptr<std::vector<std::shared_ptr<iresult_row>>> _rows;
};

std::shared_ptr<iresult> createResult();

}}// namespace baja::storage